﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Remoting.Messaging;

namespace XiaoMan.Model.Models
{
    public class DbContextFactory
    {
        public static XiaoManS10Context GetDbContext()
        {
            XiaoManS10Context context = CallContext.GetData("DbContext") as XiaoManS10Context;
            if (context == null)
            {
                context = new XiaoManS10Context();
                CallContext.SetData("DbContext", context);
            }
            return context;
        }
        public static int SaveChanges()
        {
            return DbContextFactory.GetDbContext().SaveChanges();
        }
    }
}
